using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace App.SolInf.Modelo
{
    public class Compra : ITransaccion, INotifyPropertyChanged
    {
        private Proveedor _proveedor;
        private Documentacion _documentacion;

        public Compra()
        {
            Lineas = new List<LineaCompra>();
        }


        public virtual event PropertyChangedEventHandler PropertyChanged;

        public virtual Int32 Id { get; set; }

        

        public virtual Documentacion Documentacion
        {
            get { return _documentacion ?? (_documentacion = new Documentacion()); }
            set { _documentacion = value; }
        }

        public virtual Proveedor Proveedor
        {
            get { return _proveedor; }
            set
            {
                _proveedor = value;
                _propertyChanged("Proveedor");
            }
        }

        public virtual IList<LineaCompra> Lineas { get; set; }
        public override string ToString()
        {
            return "COMPRA";
        }

        public virtual DateTime? FechaAlta { get; set; }

        private void _propertyChanged(string property)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
    }
}